﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/List.Master" AutoEventWireup="true" CodeBehind="R010_2.aspx.cs" Inherits="Honestysoft.Financing.WebUI.Module.Reports.R010_2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript">
        function getRootPath() {
            var strFullPath = window.document.location.href;
            var strPath = window.document.location.pathname;
            var pos = strFullPath.indexOf(strPath);
            var prePath = strFullPath.substring(0, pos);
            var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);
            return (prePath + postPath);
        }
        var rootPath = getRootPath();
        function locking() {
            document.getElementById("adownLoad").style.display = "none";
            document.getElementById("idocx").style.height = "0";
            document.getElementById("divImg").innerHTML = "<img src='../../images/loading1.gif' alt='' />";
            document.all.ly.style.display = "block";
            document.all.ly.style.width = document.body.clientWidth;
            document.all.ly.style.height = document.body.clientHeight;
            document.all.Layer2.style.display = 'block';
        }
        function unlocking() {
            document.getElementById("adownLoad").style.display = "block";
            document.getElementById("idocx").style.height = "650";
            document.all.ly.style.display = 'none';
            document.all.Layer2.style.display = 'none';
        }
        function query() {
            locking();
            var val3 = document.getElementById("<%=dtpRptDate.ClientID %>").value;
            if (val3 == "") {
                alert("请指定统计日期！");
                unlocking();
                return;
            }
            $.ajax({
                type: "POST",
                url: 'JSON/GetR010.ashx?Date=' + val3 + '&randID=' + escape(new Date()),
                success: function (msg) {
                    if (msg == "1") {
                        openExcel();
                        unlocking();
                    }
                },
                error: function () { unlocking(); alert('服务器出错,无法获取数据！'); }
            });
        }
        function downLoad() {
            var val3 = document.getElementById("<%=dtpRptDate.ClientID %>").value;
            var fileName = rootPath + '/Reports/JD/' + val3 + ".xls";
            window.open(fileName);
        }
    </script>
    <script language="javascript" type="text/javascript">
        function openExcel() {
            var val3 = document.getElementById("<%=dtpRptDate.ClientID %>").value;
            var fileName = rootPath + '/Reports/JD/' + val3 + ".xls";
            document.all.MyOffice.Open(fileName, false, "Excel.Sheet");
            //进入不留痕状态
            document.all.MyOffice.SetTrackRevisions(0);
            //接受当前修订
            document.all.MyOffice.SetTrackRevisions(4);
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="ly" style="position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777;z-index: 999; left: 0px; display: none;">
        </div>
        <!--浮层框架开始-->
        <div id="Layer2" align="center" style="position: absolute; z-index: 3; left: 250px; top: 50px;background-color: #fff; " >
            <table width="300" border="0" cellpadding="0" cellspacing="0" style="border: 0   solid   #e7e3e7;border-collapse: collapse">
                <tr>
                    <td height="80px" align="center">
                        <table>
                            <tr>
                                <td style="width:40px;text-align:center"><div id='divImg' style="float:left;padding:12px;width:40px"></div></td>
                                <td style="font-size:12px">正在生成计划进度示意图，请稍候……</td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <!--浮层框架结束-->
    <div region="north" split="true" border="false" style="padding:0px;overflow:hidden;height:30px;font-size:12px">
     <div style="float:left;">
    统计日期：<asp:TextBox ID="dtpRptDate" runat="server" cssClass="input2" onfocus="setday(this);" Width="100px"></asp:TextBox>
<asp:Button runat="server" ID="btnQuery" Text="查 询" class="btn_normal" OnClientClick="query();return false;"
                onmouseover="this.className='btn_active'" 
                onmouseout="this.className='btn_normal'" />
    </div>
                <div style="float:left" class="infoContainer" id="adownLoad">
                <a href="#" onclick="downLoad();" >下载Excel文件</a>
                </div>
        </div>
    <div style="text-align: center;" id="idocx">
           <object classid="clsid:00460182-9E5E-11D5-B7C8-B8269041DD57" name='MyOffice' id="MyOffice" style="LEFT:0px; TOP:0px; WIDTH:100%; HEIGHT:650px" CodeBase="../Project/dsoframer.cab#version=2,3,0,1">
                    
            </object>
        </div>
</asp:Content>
